myApp.factory('accountService', ['$http', '$q', '$rootScope', function ($http, $q, $rootScope) {
    var accountService = {};
    var apiUrl = $rootScope.url + '/web/user';
    var that = this; //
    var defered = $q.defer();
    var url = $rootScope.urlZ;
    var postCfg = {
        headers: {'Content-Type': 'application/x-www-form-urlencoded'},
        transformRequest: function (data) {
            return $.param(data);
        }
    };
    /*
     *获取账号列表
     * */
    accountService.getList = function () {
        return $http.get(apiUrl + '');
    };

    accountService.create = function (data) {
        return $http.post(apiUrl+'/create',data,postCfg);
    };

    accountService.getDetail = function (userId) {
        return $http.get(apiUrl + '/' + userId);
    };

    return accountService;
}]);
